package com.lagou.server;

/**
 * HTTP协议工具类
 */
public class HttpProtocolUtil {

    /**
     * 响应码：200
     */
    public static String getHttpHeader200(long contentLength) {
        return "HTTP/1.1 200 OK \n"
                + "Content-Type: text/html \n"
                + "Content-Length: " + contentLength + "\n"
                + "\r\n";
    }

    /**
     * 响应码：404
     */
    public static String getHttpHeader404() {
        String msg404 = "<h1>404 Not Found</h1>";
        return "HTTP/1.1 404 NOT Found \n"
                + "Content-Type: text/html \n"
                + "Content-Length: " + msg404.getBytes().length + "\n"
                + "\r\n"
                + msg404;
    }

}
